﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PlanetSim.ParticleSimulator
{
    public class ParticleData
    {
        public float X;
        public float Y;
        public float VelocityX;
        public float VelocityY;
        public float Radius;
        public float Mass;
        public float Density;

        public ParticleData(Particle p) :
            this(p.Position.X, p.Position.Y, p.Mass)
        {
            this.Density = p.Density;
            this.Radius = p.Simulation.Parameters.SmoothLength / 2;
            this.VelocityX = p.Velocity.X;
            this.VelocityY = p.Velocity.Y;
        }

        public ParticleData(float x, float y, float mass)
        {
            this.X = x;
            this.Y = y;
            this.Mass = mass;
        }

        public Particle BuildParticle(Simulation simulation)
        {
            Particle p = new Particle(simulation);
            p.Position = new Vector(X, Y);
            p.Velocity = new Vector(VelocityX, VelocityY);
            p.Mass = this.Mass;
            return p;
        }
    }
}
